#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>

int A;
int main(void)
{
    pid_t pid;
    pid = fork();
    if (pid > 0)//父进程
    {
        wait(NULL);
        printf("parent\n");
    }
    else if (pid == 0)
    {
        //让子进程去执行另外一个文件的程序(可执行文件)
        int r = execl("/home/china/sum_zw", "sum_zw", "123", "456", NULL);
        if (r == -1)
        {
            perror("execl error");
            return -1;
        }
        printf("hah,you guess print or not print!\n");
    }
    else
    {
        perror("fork error");
        return -1;
    }
    return 0;
}